package com.baobao.excel.easyexcel.bean;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author baobao
 * @create 2021-02-07 14:41
 * @description
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {
    @ExcelIgnore // 导出时忽略该字段
    private Integer id;


    @ExcelProperty(value = "用户名", index = 0) // value指定excel中的字段名，index对应excel第几列，从0开始
    private String name;

    @ExcelProperty(value = "年龄", index = 2)
    private Integer age;

    @DateTimeFormat("yyyy-MM-dd HH:mm:ss") // 指定日期格式
    @ExcelProperty(value = "出生日期", index = 1)
    private Date birth;

    @ExcelProperty("身份证")
    private IdCard idCard;
}
